// module.exports = function addMethod (object, name, fn) {
const addMethod = function addMethod (object, name, fn) {
  let old = object[name]
  object[name] = function () {
    if (fn.length === arguments.length) { return fn.apply(this, arguments) } else if (typeof old === 'function') { return old.apply(this, arguments) }
  }
}

// 函数节流 http://www.cnblogs.com/dolphinX/p/3403821.html
// const throttle = function throttle (method, context) {
//   clearTimeout(method.tId)
//   method.tId = setTimeout(function () {
//     method.call(context)
//   }, 500)
// }

module.exports = addMethod
// module.exports = throttle
